<template>
	<view>
		<view class="my-search-container" :style="{'background-color':bgColor}">
			<view class="my-search-box" :style="{'border-radius':radius+'rpx'}" @click="searchBoxHandler">
				<uni-icons type="search" size="17"></uni-icons>
				<text class="placeholder">搜索</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my_search",
		props:{
			// 搜索框背景颜色
			bgColor:{
				type:String,
				default:'#c00000'
			},
			// 搜索框圆角
			radius:{
				type:Number,
				default:30
			}
		},
		methods:{
			// 点击搜索
			searchBoxHandler(){
				// 触发使用该组件的页面绑定的自定义事件
				this.$emit('gotoSearch')
			}
		}
	}
</script>

<style lang="scss">
	.my-search-container {
		display: flex;
		align-items: center;
		height: 100rpx;
		.my-search-box {
			background-color: #fff;
			width: 95%;
			height: 66rpx;
			line-height: 66rpx;
			text-align: center;
			margin: 0 20rpx;
			.placeholder{
				margin-left:10rpx;
			}
		}
	}
</style>
